<?php
/**
 * Created by Command.
 * User: Vito
 */

declare (strict_types = 1);

namespace app\model;

use app\common\Util;
class Message extends BaseModel
{
    protected $append = ['status_desc'];

    public function user(){
        return $this->belongsTo('user','user_id')->bind([

            'name'=>'real_name'
        ]);
    }

    /**
     * @Description: 全局查询
     * @author: xiayu <cb1071403016@126.com>
     * @param [type] $value
     * @Date: 2022-11-11 15:48:26
     * @version: 1.0.0
     * @return [type]
     */    
    protected function getImageAttr($value)
    {
        return Util::link($value);
    }
    /**
     * @Description: 查询消息通知
     * @author: xiayu <cb1071403016@126.com>
     * @Date: 2022-11-11 15:48:54
     * @version: 1.0.0
     * @return [type]
     */
    public static function getMessage($where){

        return self::where($where)->limit(20)->order('id','desc')->select();
    }
}
